package com.wxl.common.serialport

import android.text.TextUtils
import com.wxl.common.AppContext
import com.wxl.common.wiget.SerialControlShotCircuitPop

abstract class Serial {

     fun loadData(data:String){
          if (!TextUtils.isEmpty(data) && data.length >= 30) {
               val stateCode = Integer.valueOf(data.substring(28, 30), 16)
               if (254 == stateCode) {//短路
                    SerialControlShotCircuitPop.show(AppContext.appContext.getCurrentActivity())
                    return
               }
               loadReceiveData(data)
          } else {
               loadReceiveData(data)
          }
     }

     abstract fun loadReceiveData(data: String)
}